#include <iostream>
#include <vector>

using namespace std;

struct TreeNode
{
    int val;
    TreeNode* left;
    TreeNode* right;
    TreeNode(int x)
        :val(x)
        ,left(nullptr)
        ,right(nullptr)
    {}
    TreeNode(int x, TreeNode* l, TreeNode* r)
        :val(x)
        ,left(l)
        ,right(r)
    {}
};
class Solution 
{
public:
    void inorder(TreeNode* root, vector<int>& v)
    {
        if (!root)
        {
            return;
        }
        inorder(root->left, v);
        v.emplace_back(root->val);
        inorder(root->right, v);
    }
    vector<int> inorderTraversal(TreeNode* root) 
    {
        vector<int> v;
        inorder(root, v);
        return v;
    }
};
int main()
{
    TreeNode* B = new TreeNode(3);
    TreeNode* A = new TreeNode(2, nullptr, B);
    TreeNode* root = new TreeNode(1, A, nullptr);

    Solution xz;
    vector<int> v = xz.inorderTraversal(root);
    for (auto e : v)
    {
        cout << e << " ";
    }

	return 0;
}